//
//  JrdCourseDetailInfoCell.m
//  v2ex-iOS
//
//  Created by longcheng on 16/5/21.
//  Copyright © 2016年 Singro. All rights reserved.
//

#import "JrdCourseDetailInfoCell.h"
#import "JRDCourseDetail.h"
#import "UIImageView+WebCache.h"
#import "JrdCommon.h"
@implementation JrdCourseDetailInfoCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backgroundColor = JrdNavigationBarColor;
        [self initViews];
    }
    return self;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
}

-(void)initViews{
    //图
    _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, JRD_COURSE_CELL_IMG_W, JRD_COURSE_CELL_IMG_H)];
    [self addSubview:_imageView];
    //课程名
    _courseNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 20, SCREEN_WIDTH-100, 30)];
    _courseNameLabel.textColor = [UIColor whiteColor];
    [self addSubview:_courseNameLabel];
    //价格
    _priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(_imageView.frame)+10, 200, 30)];
    _priceLabel.textColor = [UIColor whiteColor];
    _priceLabel.font = [UIFont systemFontOfSize:15];
    _priceLabel.text = @"课时:";
    [self addSubview:_priceLabel];
    //人数头像
    _numsImageView = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_priceLabel.frame)+10, CGRectGetMaxY(_imageView.frame)+15, 18, 18)];
    [_numsImageView setImage:[UIImage imageNamed:@"course_studs_nums"]];
    //[self addSubview:_numsImageView];
    //人数
    _numsLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_numsImageView.frame)+5, CGRectGetMaxY(_imageView.frame)+10, 50, 30)];
    _numsLabel.textColor = [UIColor whiteColor];
    _numsLabel.font = [UIFont systemFontOfSize:15];
    //[self addSubview:_numsLabel];
    
    //学校
    _schoolNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-20-130, CGRectGetMaxY(_imageView.frame)+10, 130, 25)];
    _schoolNameLabel.textColor = [UIColor whiteColor];
    _schoolNameLabel.layer.cornerRadius = 3;
    _schoolNameLabel.layer.masksToBounds = YES;
    _schoolNameLabel.layer.borderWidth = 1;
    _schoolNameLabel.font = [UIFont systemFontOfSize:13];
    _schoolNameLabel.layer.borderColor = [JRD_RGB(46, 158, 138) CGColor];
    //[self addSubview:_schoolNameLabel];
    _schoolNameLabel.userInteractionEnabled = YES;
    
    
    UIImageView *arrowImageview = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_schoolNameLabel.frame)-13, CGRectGetMinY(_schoolNameLabel.frame), 13, 25)];
    [arrowImageview setImage:[UIImage imageNamed:@"course_school_classify_icon"]];
    [self addSubview:arrowImageview];
    
    
    
    
}

-(void)setJzCourseDM:(JRDCourseDetail *)jzCourseDM{
    _courseDetail = jzCourseDM;
    _courseNameLabel.text = jzCourseDM.CourseName;

    _priceLabel.text = [NSString stringWithFormat:@"课时: %@课时", jzCourseDM.CourseChapterNum];
    [_imageView sd_setImageWithURL:[NSURL URLWithString:jzCourseDM.PhotoURL] placeholderImage:[UIImage imageNamed:@"lesson_default"]];

}

@end
